﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace WindowsPhoneEssentials.Testing
{
    public static class AssertEx
    {
        public static void Throws<TException>(Action action) where TException : Exception
        {
            try
            {
                action();
            }
            catch (TException)
            {
                return;
            }

            Assert.Fail("Expected Exception of type {0} to be thrown", typeof(TException).Name);
        }
    }
}